<%--
  Created by IntelliJ IDEA.
  User: xiaoding
  Date: 2021/1/18
  Time: 16:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<html>
<head>
    <title>添加图书</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/bootstrap-3.3.7-dist/css/book.css">
    <script src="../bootstrap-3.3.7-dist/js/JQuery.js" type="text/javascript" charset="utf-8"></script>
    <script>
        $(document).ready(function() {
            $.ajax({
                url : "../NextBookTypeServlet?flag=selectJSON",//后台请求的数据，用的是PHP
                dataType : "json",//数据格式
                type : "post",//请求方式
                async : true,//是否异步请求
                success : function(data) {   //如果请求成功，返回数据。
                    //存储传输的数据
                    var json = "";
                    for (var i = 0;i<data.data.length;i++) {
                        json += "<option value="+data.data[i].bId+">"+data.data[i].bName+"</option>";
                    }
                    //将内容添加到图书分类中
                    $("#bCategory").append(json);
                },
            })
        })
    </script>
</head>
<body>
    <form action="../NextBookServlet?flag=add" class="popupWin" method="post" id="popupWin">
        <h3>添加图书</h3>
        <div class="popupWinInput">
            <input type="hidden" value="${param.page}" name="page" id="page">
            <input type="hidden" value="${param.bName}" name="bName" id="bName">
            <p>
                <span>图书名称：</span>
                <input required="required" type="text" name="bNames" id="bNames">
            </p>
            <p>
                <span>图书作者：</span>
                <input required="required" type="text" name="author" id="author">
            </p>
            <p>
                <span>图书分类</span>
                <select required="required" name="bCategory" id="bCategory">

                </select>
            </p>
            <p>
                <span>出版社：</span>
                <input required="required" type="text" name="publishing" id="publishing">
            </p>
            <p>
                <span>图书数量：</span>
                <input required="required" type="text" name="count" id="count">
            </p>
            <p>
                <span>图书编号：</span>
                <input required="required" type="text" name="bookNumber" id="bookNumber">
            </p>
        </div>
        <hr>
        <div class="popupWinButton">
            <input type="submit" id="queDing" value="确定">
        </div>
    </form>
</body>
</html>
